open(BUFF,"SNP1.txt");
open(BUFF1,"snpsloc1.txt");
open(WRBUFF,">SNP_maf10_all_germline_sample.txt");
open(WRBUFF1,">snpsloc_maf10_all_germline_sample.txt");
$tot_num = 0;
$min_num = 0;
$line=<BUFF>;
print WRBUFF $line;
$line1=<BUFF1>;
print WRBUFF1 $line1;
while($line=<BUFF>)
{
	$line1=<BUFF1>;
	chomp($line);
	@array = split(/\t/,$line);
	shift(@array);
	#shift(@array);
	#shift(@array);
	#shift(@array);
	#print @array."\n";
	$p[0] = 0;
	$p[1] = 0;
	$p[2] = 0;
	$total = @array;
	for($i=0;$i<@array;$i++)
	{
			if($array[$i] >=0 && $array[$i]<= 0.5)
			{
				$p[0]++;
			}
			elsif($array[$i] >=1.5 && $array[$i]<= 2)
                        {
                                $p[2]++;
                        }
			else
			{
				$p[1]++;
			}
	}
	#print "$total\t$p0\t$p1\t$p2\n";
	@p1 = sort {$a <=> $b} @p;
	$minor = (2*$p1[0]+1*$p1[1])/2;
	$check = ($total/100)*10;
	if($minor < $check)
	{
		$min_num++;	
		#print "$line\n$total\t@p\t@p1\t$minor\t$check\n";
	}
	else
	{
		print WRBUFF $line."\n";
		print WRBUFF1 $line1;
	}
	#print "$total\t@p\t@p1\n";
	$tot_num++;
}
#print "$min_num\t$tot_num\n";
